package org.phantom.securityframework.web.mgt;

import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.subject.support.DefaultWebSubjectContext;

@SuppressWarnings("serial")
public class WebSubjectContext extends DefaultWebSubjectContext {

	@Override
	public Session resolveSession() {
		Session session = getSession();
        if (session == null) {
            //try the Subject if it exists:
            Subject existingSubject = getSubject();
            if (existingSubject != null) {
                session = existingSubject.getSession(true);
            }
        }
        return session;
	}

}
